package com.cy.pj.common.web;

import com.cy.pj.common.pojo.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(RuntimeException.class)
    private JsonResult doHandleRuntimeException(RuntimeException e){
        e.printStackTrace();//输出到控制台
        log.error("e.message {}",e.getMessage());
        return new JsonResult(e);
    }
}
